#include "mainwindow.h"
#include "ui_mainwindow.h"
#include<QAction>
MainWindow::MainWindow(QWidget *parent)
    : QMainWindow(parent)
    , ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    //设置信号，点击那个open可以出现选项
    connect(ui->actionopen,&QAction::triggered,[=](){
        //打开的文件用filename 保存下来
   QString filename= QFileDialog::getOpenFileName(this,"选择图片;",QCoreApplication::applicationFilePath());
    //if successfully open
   if(filename.isEmpty()){
       QMessageBox::warning(this,"提示","请选择一张图");
   }
// 显示到屏幕
   QPixmap pix (filename);
   ui->label->setPixmap(pix);
    });



}

MainWindow::~MainWindow()
{
    delete ui;
}

